<html>
<head><meta charset="utf-8"><title>rustc compare-mode polonius · t-compiler/wg-polonius · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/index.html">t-compiler/wg-polonius</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html">rustc compare-mode polonius</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="165087675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165087675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165087675">(May 07 2019 at 16:32)</a>:</h4>
<p>btw <span class="user-mention" data-user-id="116009">@nikomatsakis</span> I had <a href="https://github.com/rust-lang/rust/compare/master...lqd:polonius_tests" target="_blank" title="https://github.com/rust-lang/rust/compare/master...lqd:polonius_tests">this</a> to update the current polonius test expectations, was that what you wanted ? (if so I'll send a PR)</p>



<a name="165088014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165088014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165088014">(May 07 2019 at 16:36)</a>:</h4>
<p>probably the most "interesting" thing is the comment on the 2 issue-40510 tests, as I'm not sure I understand how they would pass in the regular full-nll compare-mode: they don't have .nll.stderr files, are not ignored and yet the .stderr is expecting a warning <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="165088148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165088148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165088148">(May 07 2019 at 16:38)</a>:</h4>
<p>so it's likely possible to make those 2 tests pass correctly, but I'm not familiar enough with the compare-mode tests to know how</p>



<a name="165090051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165090051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165090051">(May 07 2019 at 17:01)</a>:</h4>
<blockquote>
<p>btw <span class="user-mention silent" data-user-id="116009">nikomatsakis</span> I had <a href="https://github.com/rust-lang/rust/compare/master...lqd:polonius_tests" target="_blank" title="https://github.com/rust-lang/rust/compare/master...lqd:polonius_tests">this</a> to update the current polonius test expectations, was that what you wanted ? (if so I'll send a PR)</p>
</blockquote>
<p>Seems good, I guess the main bit of work is to investigate whether the errors are indeed expected.</p>



<a name="165091811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165091811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165091811">(May 07 2019 at 17:23)</a>:</h4>
<blockquote>
<p>I'm not sure I understand how they would pass in the regular full-nll compare-mode</p>
</blockquote>
<p>The full nll compare mode pr hadn't been merged yet.</p>



<a name="165092609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165092609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165092609">(May 07 2019 at 17:32)</a>:</h4>
<p>ah yes, thanks Matthew</p>



<a name="165092760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165092760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165092760">(May 07 2019 at 17:34)</a>:</h4>
<blockquote>
<p>... investigate whether the errors are indeed expected.</p>
</blockquote>
<p>that is, whether the blessed output reflects errors we expect, versus bugs in <code>-Zpolonius</code> ?</p>



<a name="165093695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093695">(May 07 2019 at 17:45)</a>:</h4>
<p>yeah so -- I guess changes to error messages seem fine</p>



<a name="165093717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093717">(May 07 2019 at 17:45)</a>:</h4>
<p>I just remember I had some short list of failures before that I had reviewed</p>



<a name="165093784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093784">(May 07 2019 at 17:46)</a>:</h4>
<p>the sheer number of them also makes me think they should be looked at anyway before opening a PR</p>



<a name="165093814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093814">(May 07 2019 at 17:46)</a>:</h4>
<p>this list of failures looks much larger</p>



<a name="165093823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093823">(May 07 2019 at 17:46)</a>:</h4>
<p>like, the list I had before was ~22 tests</p>



<a name="165093827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093827">(May 07 2019 at 17:46)</a>:</h4>
<p>not sure what changed</p>



<a name="165093829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093829">(May 07 2019 at 17:46)</a>:</h4>
<p>yeah same</p>



<a name="165093848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165093848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165093848">(May 07 2019 at 17:46)</a>:</h4>
<p>I feel something changed indeed :) I'll keep working on that</p>



<a name="165094021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165094021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165094021">(May 07 2019 at 17:48)</a>:</h4>
<p>the smoke tests ensure the basic things still work so there's at least that, the rest might have regressed discreetly</p>



<a name="165100470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165100470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lokalmatador <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165100470">(May 07 2019 at 19:02)</a>:</h4>
<p>hi</p>



<a name="165100934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165100934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165100934">(May 07 2019 at 19:06)</a>:</h4>
<p>Polonius compare mode compares against NLL compare mode, so the diff will be smaller with <a href="https://github.com/rust-lang/rust/issues/60171" target="_blank" title="https://github.com/rust-lang/rust/issues/60171">#60171</a> merged</p>



<a name="165103690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165103690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165103690">(May 07 2019 at 19:38)</a>:</h4>
<p>yeah I'll rebase on top of <a href="https://github.com/rust-lang/rust/issues/60171" target="_blank" title="https://github.com/rust-lang/rust/issues/60171">#60171</a> soon to see how it changes things, a smaller diff will be indeed much easier to analyze/bisect</p>



<a name="165244077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165244077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165244077">(May 09 2019 at 11:35)</a>:</h4>
<p><code>test result: FAILED. 5443 passed; 19 failed</code> now that's more like it <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="165245847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165245847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165245847">(May 09 2019 at 12:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> what changed? just a rebase?</p>



<a name="165246209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165246209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165246209">(May 09 2019 at 12:11)</a>:</h4>
<p>retesting over matthew's <a href="https://github.com/rust-lang/rust/issues/60171" target="_blank" title="https://github.com/rust-lang/rust/issues/60171">#60171</a> indeed</p>



<a name="165246215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165246215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165246215">(May 09 2019 at 12:11)</a>:</h4>
<p>(which hasn't landed yet)</p>



<a name="165246278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165246278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165246278">(May 09 2019 at 12:12)</a>:</h4>
<p>the other 200 differences were because that compare-mode polonius runs with NLLs while the NLL compare-mode runs in migrate-mode</p>



<a name="165246402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165246402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165246402">(May 09 2019 at 12:14)</a>:</h4>
<p>with <a href="https://github.com/rust-lang/rust/issues/60171" target="_blank" title="https://github.com/rust-lang/rust/issues/60171">#60171</a> the NLL compare-mode will run with the regular NLLs</p>



<a name="165272454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165272454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165272454">(May 09 2019 at 17:29)</a>:</h4>
<p>OK so <a href="https://github.com/lqd/rust/commit/c40be9633d1eef5cd89e8fc934b1c62de3493a59" target="_blank" title="https://github.com/lqd/rust/commit/c40be9633d1eef5cd89e8fc934b1c62de3493a59">here</a> are these 19 tests behaving differently under polonius (in a future where <a href="https://github.com/rust-lang/rust/issues/60171" target="_blank" title="https://github.com/rust-lang/rust/issues/60171">#60171</a> has switched the NLL compare-mode to full NLLs), and I've done a quick WIP first pass at analyzing the results <a href="https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg" target="_blank" title="https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg">here</a>.</p>



<a name="165272513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165272513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165272513">(May 09 2019 at 17:30)</a>:</h4>
<p>I'll keep working on it this week, to make it actually presentable/understandable, add links and diffs etc, in addition to filling in more content ofc -- so that it can be validated/invalidated.</p>



<a name="165272533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165272533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165272533">(May 09 2019 at 17:30)</a>:</h4>
<p>That being said, it seems to me at least 5 tests should be ignored or a dedicated polonius output identical to the NLL one should be added. Then, a couple are duplicates or similar to other failures. Then, some slight expected differences in diagnostics handling. And a handful "looking interesting", that is, requiring a more in-depth investigation.</p>



<a name="165273464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165273464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165273464">(May 09 2019 at 17:44)</a>:</h4>
<p>(I also wanted to check a thing with Matthew later about the NLL and Polonius compare modes, in that, in cases where the polonius output was expected to be the same as the NLL one, but the latter was manually tested via revisions instead of the compare-mode, whether we should add polonius revisions there as well)</p>



<a name="165273797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165273797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165273797">(May 09 2019 at 17:48)</a>:</h4>
<p>(I also added "correctness and testsuite analysis" to the roadmap like we mentioned yesterday -- and will do the meeting minutes PR soon, including the one from 2 weeks ago I apparently haven’t done either...)</p>



<a name="165520355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165520355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165520355">(May 13 2019 at 11:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> How do you run these tests by the way?</p>



<a name="165522453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165522453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165522453">(May 13 2019 at 12:19)</a>:</h4>
<p>using x.py test, it has a set of flags to trigger the compare mode (and there's one for NLLs, and one for Polonius) like so <code>./x.py test -i --stage 1 src/test/ui --compare-mode polonius</code>, here for the ui test suite</p>



<a name="165522588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165522588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165522588">(May 13 2019 at 12:21)</a>:</h4>
<p>also, the specific results are ran over <a href="https://github.com/rust-lang/rust/issues/60171" target="_blank" title="https://github.com/rust-lang/rust/issues/60171">#60171</a> (which Felix is reviewing), so running them on master will produce 200 more failures or so</p>



<a name="165540821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165540821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165540821">(May 13 2019 at 15:48)</a>:</h4>
<p>Ah, ok, and I haven't merged in a while either</p>



<a name="165540832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165540832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165540832">(May 13 2019 at 15:48)</a>:</h4>
<p>Thanks!</p>



<a name="165573531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165573531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165573531">(May 13 2019 at 22:06)</a>:</h4>
<p>update: <a href="https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view" target="_blank" title="https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view">the first pass</a> feels somewhat presentable (now a pause to do the meeting minutes PR I've been forgetting) and then hopefully fill more content in this document if I can</p>



<a name="165613999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165613999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165613999">(May 14 2019 at 11:29)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> I was wondering about cases like <a href="https://github.com/rust-lang/rust/blob/8fa44c061b7d2db63eed229810f34f1e13633eea/src/test/ui/borrowck/issue-45983.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/8fa44c061b7d2db63eed229810f34f1e13633eea/src/test/ui/borrowck/issue-45983.rs">this</a> in compare mode. The Polonius output is the same as the NLL output, and the test is ignored in NLL compare mode and manually checked via revisions. Would you say that we should ignore them in polonius compare-mode, add the expected Polonius output, by having dedicated revisions, each time tests are constructed in this manner ?</p>



<a name="165614288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165614288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165614288">(May 14 2019 at 11:35)</a>:</h4>
<p>(or maybe there was a compare-mode feature one could use for these cases where one test should be similar to another existing one, for the cases like these where most existing things should continue working as-is in the new feature superset)</p>



<a name="165617053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165617053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165617053">(May 14 2019 at 12:23)</a>:</h4>
<p>Ignoring or adding a revision sounds good.</p>



<a name="165626174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/165626174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#165626174">(May 14 2019 at 14:20)</a>:</h4>
<p>thanks! For these most obvious ones I was thinking to both ignore them and open an issue similar to what we have for NLLs coverage about revisions: "before long, review the uses of '// ignore' in polonius mode to ensure good coverage" as these 4-5 tests are right now literally testing only the NLL part, and failing in compare-mode only. just until things are more "proven" (and CI gated), not have too many revisions testing the same things, nll/migrate/polonius * 2015/2018 to maintain, etc</p>



<a name="169557297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169557297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169557297">(Jul 03 2019 at 11:12)</a>:</h4>
<p>in the current failures analysis <span class="user-mention" data-user-id="116009">@nikomatsakis</span> I ended up with this <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=9c346b9552cb79f1153554628826e0d8" target="_blank" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=9c346b9552cb79f1153554628826e0d8">interesting error</a>. I talked about it with Matthew <a href="https://hackmd.io/ZNVf2aqJTPC4mOQP0rZenQ?view#31-%E2%80%94-The-one-I-looked-at-most-a-loop-from-rand" target="_blank" title="https://hackmd.io/ZNVf2aqJTPC4mOQP0rZenQ?view#31-%E2%80%94-The-one-I-looked-at-most-a-loop-from-rand">here</a> and they seem to think it's a problem in fact generation. Since it looks like a simplified version of the dreaded 47680 I wondered if you thought it should be fixed in rustc or in the polonius analysis <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="169557469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169557469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169557469">(Jul 03 2019 at 11:17)</a>:</h4>
<p>in that the loan from the previous iteration of the loop should be <code>killed</code> or not considered live</p>



<a name="169558133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169558133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169558133">(Jul 03 2019 at 11:30)</a>:</h4>
<p>(this is one of the cases where I'd have found useful to have datalog provenance, so I might look into hacking a simple helper into datafrog)</p>



<a name="169641397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169641397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169641397">(Jul 04 2019 at 11:46)</a>:</h4>
<p>and the MIR annotated with some facts: <a href="https://gist.github.com/lqd/44fb87e709d36e0b2ddc5949dde4243e" target="_blank" title="https://gist.github.com/lqd/44fb87e709d36e0b2ddc5949dde4243e">here</a> (some of the annotations I added are artifacts of Polonius interning so I could better follow the datalog provenance)</p>



<a name="169659066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169659066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169659066">(Jul 04 2019 at 16:23)</a>:</h4>
<p>I <em>think</em> I got it</p>



<a name="169659296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169659296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169659296">(Jul 04 2019 at 16:29)</a>:</h4>
<p>the loans are not killed because we only generate those facts for <em>assignments</em> (and assignments to locals only, not projections, as Matthew mentioned). This case here is not an assignment, it's a call where the destination place has loans. This specific case seems to pass when I kill <em>those</em> loans</p>



<a name="169660251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169660251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169660251">(Jul 04 2019 at 16:47)</a>:</h4>
<p>it also makes <code>borrowck/borrowck-lend-flow-loop.rs</code> pass, so there's that.<br>
(but barely none of the <code>rand</code> reductions, even though I initially started with those, before mixing in a little bit of <a href="https://github.com/rust-lang/rust/issues/47680" target="_blank" title="https://github.com/rust-lang/rust/issues/47680">#47680</a>)</p>



<a name="169662274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169662274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169662274">(Jul 04 2019 at 17:30)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> rn I'm doing <a href="https://github.com/rust-lang/rust/blob/8301de16dafc81a3b5d94aa0707ad83bdb56a599/src/librustc_mir/borrow_check/nll/constraint_generation.rs#L130-L140" target="_blank" title="https://github.com/rust-lang/rust/blob/8301de16dafc81a3b5d94aa0707ad83bdb56a599/src/librustc_mir/borrow_check/nll/constraint_generation.rs#L130-L140">this</a> when visiting a terminator call, do I also need to take special care of possible edge cases with calls, or can I just kill the loans like so on the call's destination ?</p>



<a name="169668551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169668551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169668551">(Jul 04 2019 at 20:04)</a>:</h4>
<p>That should be fine, although you should probably try to only do it on the return edge from the call (not the unwind edge).</p>



<a name="169668565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169668565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169668565">(Jul 04 2019 at 20:05)</a>:</h4>
<p>It may also be more effective to kill loans on <code>StorageDead</code> statements instead, that may need investigation though.</p>



<a name="169669083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169669083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169669083">(Jul 04 2019 at 20:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> ok I see, thanks a lot for all the help :)</p>



<a name="169700424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169700424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169700424">(Jul 05 2019 at 10:58)</a>:</h4>
<p>plot twist, the test passes for  rustc <code>-Zpolonius</code>, but polonius itself actually still reports an error (it used to report 2 before the change), so that's strange. As for the analysis, the remaining error might be because in a single mir statement, the loan is invalidated at the start point but killed at the mid point <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> I'll keep tracing</p>



<a name="169743917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169743917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169743917">(Jul 06 2019 at 00:34)</a>:</h4>
<p>I may have a theory, related to invalidating and killing loans in the same mir statement: that happens at 2 different points. The computation of the region/provenance seems to include the statement's start point (because the loans are killed on mid points) and the mid point (because we stop propagating the TC from kill points), and if the region is live and contains the loan (eg in a loop) there will be an error at the start point. I'm not sure I know the reasons why <code>invalidates</code>/<code>killed</code> are at the locations they are, but maybe they should be at the same point (at least if the loan is the same) ? (This is, I believe, causing the 2nd error reported by Polonius I mentioned in the previous message — but I'd still like to understand why rustc didn't mind this error though)</p>



<a name="169757202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169757202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169757202">(Jul 06 2019 at 07:57)</a>:</h4>
<p>If you're not killing loans for <code>StorageDead</code> statements, then you'll need to change this <a href="https://github.com/rust-lang/rust/blob/b820c761744db080ff7a4ba3ac88d259065cb836/src/librustc_mir/borrow_check/nll/invalidation.rs#L197" target="_blank" title="https://github.com/rust-lang/rust/blob/b820c761744db080ff7a4ba3ac88d259065cb836/src/librustc_mir/borrow_check/nll/invalidation.rs#L197">https://github.com/rust-lang/rust/blob/b820c761744db080ff7a4ba3ac88d259065cb836/src/librustc_mir/borrow_check/nll/invalidation.rs#L197</a> to <code>Shallow(None)</code>.</p>



<a name="169757259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169757259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169757259">(Jul 06 2019 at 07:59)</a>:</h4>
<p>The kill and the invalidates facts are at the same point because we want this to be an error:</p>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span><span class="w"></span>
<span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">a</span><span class="p">;</span><span class="w"></span>
<span class="kd">let</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">x</span><span class="p">;</span><span class="w"> </span><span class="c1">// L</span>
<span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">b</span><span class="p">;</span><span class="w"> </span><span class="c1">// This both kills and invalidates the loan at L</span>
<span class="n">drop</span><span class="p">(</span><span class="n">y</span><span class="p">);</span><span class="w"></span>
</pre></div>



<a name="169757363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169757363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169757363">(Jul 06 2019 at 08:01)</a>:</h4>
<p>ah interesting thank you, I think some loans are indeed killed on StorageDead, it didn’t seem to be all the time (or maybe not and I'm just thinking about invalidations)</p>



<a name="169757517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169757517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169757517">(Jul 06 2019 at 08:05)</a>:</h4>
<p>yes indeed; they’re lowered as 2 "polonius points" today, for the same "MIR point", I wonder if this was linked to 2PB or something else</p>



<a name="169757926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169757926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169757926">(Jul 06 2019 at 08:18)</a>:</h4>
<p>the rules are setup to handle this, invalidating L on the start point and killing L on the mid point, the loan being live on start makes your example  an error</p>



<a name="169757942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169757942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169757942">(Jul 06 2019 at 08:19)</a>:</h4>
<p>(regardless of the kill)</p>



<a name="169758167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169758167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169758167">(Jul 06 2019 at 08:26)</a>:</h4>
<p>so this lowering works for sure in most cases, but not where in MIR a loan is both invalidated and killed at the same point <em>and</em> the same loan is added to a "borrow region" (which also happens in mid points IIRC)</p>



<a name="169758285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169758285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169758285">(Jul 06 2019 at 08:30)</a>:</h4>
<p>making eg this an error</p>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">buf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="k">loop</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">buf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">index_mut</span><span class="p">(</span><span class="n">buf</span><span class="p">);</span><span class="w"> </span><span class="c1">// accepted by NLL, rejected by Polonius</span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="169758619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169758619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169758619">(Jul 06 2019 at 08:41)</a>:</h4>
<p>(because the loan from the previous iteration will be live on these 2 points)</p>



<a name="169759349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169759349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169759349">(Jul 06 2019 at 09:07)</a>:</h4>
<p>and if my understanding is correct, it's also the cause of this additional error</p>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Vec</span>::<span class="n">new</span><span class="p">();</span><span class="w"></span>
<span class="k">loop</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="c1">// Polonius rejects this as an assignment to borrowed value</span>
<span class="w">    </span><span class="n">x</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">y</span><span class="p">);</span><span class="w"> </span><span class="c1">// here we also have the expected error: y doesn&#39;t live long enough</span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>(so it's like an off-by-one error where in these specific cases the regions contain the loans a couple points too long)</p>



<a name="169868175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/169868175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#169868175">(Jul 08 2019 at 13:23)</a>:</h4>
<p>The fix might be obvious but it's not yet the case to me. Things I've tried which didn't work:</p>
<ul>
<li>emitting the kill at the start point: only shortens the region by one point (the loan dies between the start point and the mid point, because the rules propagate <code>requires</code> between points P&amp;Q if P is !killed) so doesn't change much in our case</li>
<li>considering the loan dead a bit earlier: propagating if Q is !killed (and emitting the kill at the start point), even more rustc tests fail</li>
<li>filtering the error if the loan is killed in the successor point: other polonius tests fail so it doesn't seem the way to go either</li>
</ul>



<a name="170440042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440042">(Jul 09 2019 at 10:14)</a>:</h4>
<blockquote>
<p>It may also be more effective to kill loans on <code>StorageDead</code> statements instead, that may need investigation though.</p>
</blockquote>
<p>this should definitely be ok</p>



<a name="170440215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440215">(Jul 09 2019 at 10:17)</a>:</h4>
<p>So, <span class="user-mention" data-user-id="116113">@lqd</span>, reading back over the log, a few questions:</p>
<ul>
<li>Did you wind up resolving the original problem?</li>
<li>If so, how precisely?</li>
</ul>



<a name="170440259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440259">(Jul 09 2019 at 10:18)</a>:</h4>
<p>unfortunately not</p>



<a name="170440268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440268">(Jul 09 2019 at 10:18)</a>:</h4>
<p>It seems like the "points" we use for polonius may be insufficiently precise</p>



<a name="170440280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440280">(Jul 09 2019 at 10:18)</a>:</h4>
<p>/me thinks</p>



<a name="170440283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440283">(Jul 09 2019 at 10:18)</a>:</h4>
<p>I only narrowed it down to this pattern of loops causing problems</p>



<a name="170440296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440296">(Jul 09 2019 at 10:19)</a>:</h4>
<blockquote>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">buf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="k">loop</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">buf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">index_mut</span><span class="p">(</span><span class="n">buf</span><span class="p">);</span><span class="w"> </span><span class="c1">// accepted by NLL, rejected by Polonius</span>
<span class="p">}</span><span class="w"></span>
</pre></div>


</blockquote>
<p>this pattern?</p>



<a name="170440314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440314">(Jul 09 2019 at 10:19)</a>:</h4>
<p>in general yes</p>



<a name="170440317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440317">(Jul 09 2019 at 10:19)</a>:</h4>
<p>where presumably <code>index_mut</code> is <code>fn(&amp;mut u32) -&gt; &amp;mut 32</code></p>



<a name="170440320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440320">(Jul 09 2019 at 10:19)</a>:</h4>
<p>but in mir it's a bit more precise</p>



<a name="170440349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440349">(Jul 09 2019 at 10:19)</a>:</h4>
<p><a href="https://gist.github.com/lqd/44fb87e709d36e0b2ddc5949dde4243e#file-loopdydoo-mir-L75-L78" target="_blank" title="https://gist.github.com/lqd/44fb87e709d36e0b2ddc5949dde4243e#file-loopdydoo-mir-L75-L78">here</a></p>



<a name="170440451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440451">(Jul 09 2019 at 10:20)</a>:</h4>
<p>my "fix" only fixes one of the errors (the bottom one) but not the first where we have the invalidation preceding the kill, but the "previous iteration" loan is live on start</p>



<a name="170440499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440499">(Jul 09 2019 at 10:21)</a>:</h4>
<p>note that this passes in rustc though, which is another strange thing</p>



<a name="170440579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440579">(Jul 09 2019 at 10:22)</a>:</h4>
<p>Did you try to kill loans on StorageDead?</p>



<a name="170440592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440592">(Jul 09 2019 at 10:22)</a>:</h4>
<p>in that polonius -engine returns an error but rustc seems to ignore it (maybe a remnant of switching from computing all the live loans to errors)</p>



<a name="170440606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440606">(Jul 09 2019 at 10:22)</a>:</h4>
<p>Huh</p>



<a name="170440609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440609">(Jul 09 2019 at 10:22)</a>:</h4>
<p>That <em>is</em> strange</p>



<a name="170440622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440622">(Jul 09 2019 at 10:23)</a>:</h4>
<p>no I have not but I can try this quick I think</p>



<a name="170440624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440624">(Jul 09 2019 at 10:23)</a>:</h4>
<p>And a bit disturbing :)</p>



<a name="170440630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440630">(Jul 09 2019 at 10:23)</a>:</h4>
<p>exactly :)</p>



<a name="170440639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440639">(Jul 09 2019 at 10:23)</a>:</h4>
<p>It seems like  </p>
<div class="codehilite"><pre><span></span>StorageDead(_5);                 // bb4[4]: p32-33
</pre></div>


<p>ought to kill L2</p>



<a name="170440653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440653">(Jul 09 2019 at 10:23)</a>:</h4>
<p>(er, wait, is that right?)</p>



<a name="170440659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440659">(Jul 09 2019 at 10:24)</a>:</h4>
<p>I'm killing it at the call rn</p>



<a name="170440701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440701">(Jul 09 2019 at 10:24)</a>:</h4>
<p>Yes, that's right.</p>



<a name="170440708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440708">(Jul 09 2019 at 10:24)</a>:</h4>
<p>Well, both of them basically destroy the value of <code>_5</code></p>



<a name="170440716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440716">(Jul 09 2019 at 10:24)</a>:</h4>
<p>although the semantics of <code>StorageDead</code> <em>are</em> pretty unclear</p>



<a name="170440728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440728">(Jul 09 2019 at 10:24)</a>:</h4>
<p>yeah, I also feel we've seen with the generators optimizations that we might not always have StorageDead's everywhere</p>



<a name="170440754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440754">(Jul 09 2019 at 10:25)</a>:</h4>
<p>so it seemed safer at the call, but it wasn't enough anyway :)</p>



<a name="170440756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440756">(Jul 09 2019 at 10:25)</a>:</h4>
<p>for unwind paths we don't generate them all the time</p>



<a name="170440852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440852">(Jul 09 2019 at 10:26)</a>:</h4>
<p>killing it at the StorageDead fixes the error darn it</p>



<a name="170440942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440942">(Jul 09 2019 at 10:28)</a>:</h4>
<p>well so I think both spots are correct to do the kill</p>



<a name="170440953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440953">(Jul 09 2019 at 10:28)</a>:</h4>
<p>I think you could make a test where the call is required</p>



<a name="170440976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440976">(Jul 09 2019 at 10:29)</a>:</h4>
<p>although i'm wondering what it is :P</p>



<a name="170440985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440985">(Jul 09 2019 at 10:29)</a>:</h4>
<p>it might be that it's hard to do because rustc introduces temporaries</p>



<a name="170440993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170440993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170440993">(Jul 09 2019 at 10:29)</a>:</h4>
<blockquote>
<p>killing it at the StorageDead fixes the error darn it</p>
</blockquote>
<p>were you saying <em>just</em> killing it at <code>StorageDead</code> is sufficient?</p>



<a name="170441267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441267">(Jul 09 2019 at 10:33)</a>:</h4>
<p>yes</p>



<a name="170441283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441283">(Jul 09 2019 at 10:33)</a>:</h4>
<p>just killing it at the storagedead was sufficient</p>



<a name="170441297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441297">(Jul 09 2019 at 10:33)</a>:</h4>
<p>to stop both errors, I think (I have to juggle branches ;)</p>



<a name="170441404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441404">(Jul 09 2019 at 10:35)</a>:</h4>
<p>are there complications on killing loans on StorageDead ? like, I was wondering whether it wouldn't "lengthen" the regions</p>



<a name="170441422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441422">(Jul 09 2019 at 10:35)</a>:</h4>
<p>so I think that if you have <code>foo = bar(..)</code> where <code>foo</code> was already initialized, we will always generate a temporary intermediate</p>



<a name="170441426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441426">(Jul 09 2019 at 10:35)</a>:</h4>
<p>this is just generally true for <code>foo = ...</code></p>



<a name="170441483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441483">(Jul 09 2019 at 10:36)</a>:</h4>
<blockquote>
<p>are there complications on killing loans on StorageDead ? like, I was wondering whether it wouldn't "lengthen" the regions</p>
</blockquote>
<p>say more? I've always assumed we would kill loans there, I think it's actually kinda <em>necessary</em></p>



<a name="170441518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441518">(Jul 09 2019 at 10:36)</a>:</h4>
<p>maybe my thinking is too focused on this example</p>



<a name="170441543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441543">(Jul 09 2019 at 10:37)</a>:</h4>
<p>where the StorageDead is a bit later than the call</p>



<a name="170441631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441631">(Jul 09 2019 at 10:38)</a>:</h4>
<p>so I didn't want to unexpectedly kills loan "too late" but it doesn't look like it'd matter, esp if it's necessary to do so :)</p>



<a name="170441668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441668">(Jul 09 2019 at 10:39)</a>:</h4>
<p>I'll try this out this afternoon, it'd be super nice to have this taken care of</p>



<a name="170441761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441761">(Jul 09 2019 at 10:40)</a>:</h4>
<p>ah, I see what you mean</p>



<a name="170441779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441779">(Jul 09 2019 at 10:40)</a>:</h4>
<p>I mean I agree that we should kill loans at the call return point, too</p>



<a name="170441785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441785">(Jul 09 2019 at 10:40)</a>:</h4>
<p>though I'm trying to come up with an example that would show why :)</p>



<a name="170441794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441794">(Jul 09 2019 at 10:40)</a>:</h4>
<p>:)</p>



<a name="170441814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441814">(Jul 09 2019 at 10:41)</a>:</h4>
<p>(it may be that you have to write MIR by hand to show why)</p>



<a name="170441846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441846">(Jul 09 2019 at 10:42)</a>:</h4>
<p>can we simply kill loans at both mir statements or do we have to somehow kill at only one of the two depending on the situation ?</p>



<a name="170441903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170441903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170441903">(Jul 09 2019 at 10:42)</a>:</h4>
<p>seems alright to me but I don't know</p>



<a name="170442807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170442807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170442807">(Jul 09 2019 at 10:56)</a>:</h4>
<p>both is fine</p>



<a name="170442839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170442839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170442839">(Jul 09 2019 at 10:57)</a>:</h4>
<p>sweet I'll try it soon :)</p>



<a name="170443094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170443094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170443094">(Jul 09 2019 at 11:01)</a>:</h4>
<p>basically any time that the previous value of <code>x</code> is destroyed, we should be able to kill loans of <code>x</code></p>



<a name="170443150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170443150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170443150">(Jul 09 2019 at 11:02)</a>:</h4>
<p>(or, as in this case, projections from <code>x</code>)</p>



<a name="170443179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170443179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170443179">(Jul 09 2019 at 11:02)</a>:</h4>
<p>(note though that if <code>x</code> itself is borrowed (and not <code>*x</code>), then assigning to <code>x</code> may be an error itself)</p>



<a name="170443440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170443440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170443440">(Jul 09 2019 at 11:07)</a>:</h4>
<p>it's true that we also don't handle projections now</p>



<a name="170452920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170452920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170452920">(Jul 09 2019 at 13:30)</a>:</h4>
<p>yesssssssss (thanks Matthew and Niko, that's 2 less rustc regressions, and 7-10 of the different other minimizations I had)</p>



<a name="170923734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/170923734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#170923734">(Jul 15 2019 at 19:29)</a>:</h4>
<p>only 2 failures left to go (everytime I rebase there's usually another new failure <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span>)</p>



<a name="171016440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171016440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171016440">(Jul 16 2019 at 18:57)</a>:</h4>
<p>(hopefully I have fixed the cases related to assignments to projections, and only the drop data overflow remains, when asking for nll-facts)</p>



<a name="171035070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171035070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171035070">(Jul 16 2019 at 23:07)</a>:</h4>
<p>I think I'll investigate the overflow in a follow-up PR</p>



<a name="171035148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171035148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171035148">(Jul 16 2019 at 23:09)</a>:</h4>
<p>ok so the result of these last couple months of work on this: mostly complete <a href="https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view" target="_blank" title="https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view">write-up</a>, and the PR <a href="https://github.com/rust-lang/rust/issues/62736" target="_blank" title="https://github.com/rust-lang/rust/issues/62736">#62736</a> for the fixes and tests</p>



<a name="171118922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171118922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171118922">(Jul 17 2019 at 21:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> thanks for the super quick review</p>



<a name="171118945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171118945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171118945">(Jul 17 2019 at 21:25)</a>:</h4>
<p>also, agreed about your CI + tests comment</p>



<a name="171119202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171119202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171119202">(Jul 17 2019 at 21:28)</a>:</h4>
<p>maybe we can enable them on CI after the correctness and perf investigations have advanced a bit more, at the very least so that we don't slow down CI too much either (the nll compare mode seemed to slow down enough that it's not run on all builders IIRC)</p>



<a name="171119248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171119248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171119248">(Jul 17 2019 at 21:30)</a>:</h4>
<p>if we manage to enable full NLLs this year, maybe we can switch the compare mode to polonius without impacting things :) (not that it takes particularly long to run or anything; I'll think I'll time the 2 tomorrow to make sure, but I haven't noticed a big difference)</p>



<a name="171119455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171119455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171119455">(Jul 17 2019 at 21:33)</a>:</h4>
<p>(I wonder which test suites do we run the nll compare mode on, only <code>ui</code> or some of the others)</p>



<a name="171120732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171120732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171120732">(Jul 17 2019 at 21:51)</a>:</h4>
<p>ui and run-pass</p>



<a name="171120827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171120827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171120827">(Jul 17 2019 at 21:53)</a>:</h4>
<p>I've had some "interesting" behaviour on one of the run-pass tests earlier today, the float saturating cast one didn't want to terminate</p>



<a name="171121096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171121096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171121096">(Jul 17 2019 at 21:57)</a>:</h4>
<p>in any case I'll keep working on the last error, try to quantify how long it takes to run, check the run-pass as well, and we can revisit this important question hopefully soon</p>



<a name="171121210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171121210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171121210">(Jul 17 2019 at 21:59)</a>:</h4>
<p>(and likely rebase the PR even sooner than that, as another PR in the queue is going to update a lot of the blessed outputs :)</p>



<a name="171155532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171155532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171155532">(Jul 18 2019 at 10:10)</a>:</h4>
<p>ah yes it's fact generation taking forever/OOM-ing on <code>run-pass/numbers-arithmetic/saturating-float-casts.rs</code></p>



<a name="171155578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171155578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171155578">(Jul 18 2019 at 10:11)</a>:</h4>
<p>I guess we got ourselves a fact-generation benchmark</p>



<a name="171175296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171175296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171175296">(Jul 18 2019 at 14:27)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/8301de16dafc81a3b5d94aa0707ad83bdb56a599/src/librustc_mir/borrow_check/nll/type_check/mod.rs#L229-L233" target="_blank" title="https://github.com/rust-lang/rust/blob/8301de16dafc81a3b5d94aa0707ad83bdb56a599/src/librustc_mir/borrow_check/nll/type_check/mod.rs#L229-L233">this</a> is materializing 10948 x 136664 outlives constraints in this test (15GB+)</p>



<a name="171678413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/171678413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#171678413">(Jul 25 2019 at 10:09)</a>:</h4>
<p>yay <a href="https://github.com/rust-lang/rust/issues/62736" target="_blank" title="https://github.com/rust-lang/rust/issues/62736">#62736</a> landed</p>



<a name="172399450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/172399450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#172399450">(Aug 03 2019 at 09:29)</a>:</h4>
<p>So, I've finally had a look at  issues/issue-38591.rs. The reason that this is failing only for Polonius is that we don't calculate liveness for variables with no free regions with normal NLL, but we generate facts for all variables with Polonius. This shouldn't be too hard to fix, but it's probably easier to wait until we have the final fact generation code for liveness.</p>



<a name="172402709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/172402709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#172402709">(Aug 03 2019 at 11:17)</a>:</h4>
<p>oh thanks for looking into it ! makes sense</p>



<a name="172402822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/172402822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#172402822">(Aug 03 2019 at 11:21)</a>:</h4>
<p>I’m looking into "interesting" cases about statics, which Polonius dislikes for some unknown reason as of yet</p>



<a name="172402874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/172402874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#172402874">(Aug 03 2019 at 11:22)</a>:</h4>
<p>but doesn’t trigger errors when called by rustc so, yeah</p>



<a name="172444744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/172444744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#172444744">(Aug 04 2019 at 10:53)</a>:</h4>
<blockquote>
<p>So, I've finally had a look at  issues/issue-38591.rs. The reason that this is failing only for Polonius is that we don't calculate liveness for variables with no free regions with normal NLL, but we generate facts for all variables with Polonius. This shouldn't be too hard to fix, but it's probably easier to wait until we have the final fact generation code for liveness.</p>
</blockquote>
<p>This sounds a lot like it might interact with the liveness code I'm working on, right?</p>



<a name="172444989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/172444989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#172444989">(Aug 04 2019 at 11:01)</a>:</h4>
<p>yes</p>



<a name="177330785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/rustc%20compare-mode%20polonius/near/177330785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/rustc.20compare-mode.20polonius.html#177330785">(Oct 04 2019 at 11:40)</a>:</h4>
<p>Matthews's PR <a href="https://github.com/rust-lang/rust/issues/64749" target="_blank" title="https://github.com/rust-lang/rust/issues/64749">#64749</a> has now landed <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> a lot of inconsequential diagnostics differences have been eliminated, and the last (known) bug in fact generation has been fixed!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>